package com.peng.coordinatorlayoutdemo;

import android.graphics.Color;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private CollapsingToolbarLayout collapsingToolbarLayout;
    private ListView listView;
    private Toolbar concentration_detials_toolbar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);
        initView();

        initData();
        //this.setSupportActionBar(concentration_detials_toolbar);
    }

    private void initData() {

        collapsingToolbarLayout.setCollapsedTitleTextColor(Color.WHITE);
        collapsingToolbarLayout.setTitle("许我一缕清愁");

        List<String> list = new ArrayList<>();

        for (int i = 0; i < 50; i++) {
            list.add("相逢一笑抿恩仇");
        }

        ArrayAdapter<String> adapter = new ArrayAdapter<>(this,android.R.layout.simple_list_item_1,list);

        listView.setAdapter(adapter);
    }

    private void initView() {
        collapsingToolbarLayout = ((CollapsingToolbarLayout) findViewById(R.id.collapsingToolbarLayout));

        listView = ((ListView) findViewById(R.id.listView));

        concentration_detials_toolbar = ((Toolbar) findViewById(R.id.concentration_detials_toolbar));
    }
}
